import pandas as pd
df = pd.read_excel("data.xlsx")
print("-----------------------服装库-----------------------")
print(df)
print("---------------------------------------------------")
zl = df["销售量/每日"].sum()
print("销售总量:",zl)
wo = (df ['销售量/每日']*df ['价格/件'])
zj = wo.sum()
print('总销售额:',"{:.2f}".format(zj))
# wo = df_sum = df.groupby('服装名称')['销售量/每日'].sum()
# print(wo)
XLZB = df_gender = df[['服装名称','销售量/每日']]
tx = df_gender.loc[(df_gender['服装名称'] == 'T血')].sum()
tx1 = tx['销售量/每日']
nzk = df_gender.loc[(df_gender['服装名称'] == '牛仔裤')].sum()
nzk1 = nzk['销售量/每日']
pc = df_gender.loc[(df_gender['服装名称'] == '皮草')].sum()
pc1 = pc['销售量/每日']
yrf = df_gender.loc[(df_gender['服装名称'] == '羽绒服')].sum()
yrf1 = yrf['销售量/每日']
cs = df_gender.loc[(df_gender['服装名称'] == '衬衫')].sum()
cs1 = cs['销售量/每日']
fy = df_gender.loc[(df_gender['服装名称'] == '风衣')].sum()
fy1 = fy['销售量/每日']
print("-------------销量占比----------------")
print("T血销量占比：   ",format(tx1/zl,'.2%'))
print("牛仔裤销量占比： ",format(nzk1/zl,'.2%'))
print("皮草销量占比：   ",format(pc1/zl,'.2%'))
print("羽绒服销量占比： ",format(yrf1/zl,'.2%'))
print("衬衫销量占比：  ",format(cs1/zl,'.2%'))
print("风衣销量占比：  ",format(fy1/zl,'.2%'))
print("-------------销售额占比--------------")
XSEZB = df_gender = df[['服装名称','价格/件','销售量/每日']]
TX = df_gender.loc[(df_gender['服装名称'] == 'T血')]
TX1 = (TX ['销售量/每日']*TX ['价格/件']).sum()
NZK = df_gender.loc[(df_gender['服装名称'] == '牛仔裤')]
NZK1 = (NZK ['销售量/每日']*NZK ['价格/件']).sum()
PC = df_gender.loc[(df_gender['服装名称'] == '皮草')]
PC1 = (PC ['销售量/每日']*PC ['价格/件']).sum()
YRF = df_gender.loc[(df_gender['服装名称'] == '羽绒服')]
YRF1 = (YRF ['销售量/每日']*YRF ['价格/件']).sum()
CS = df_gender.loc[(df_gender['服装名称'] == '衬衫')]
CS1 = (CS ['销售量/每日']*CS ['价格/件']).sum()
FY = df_gender.loc[(df_gender['服装名称'] == '风衣')]
FY1 = (FY ['销售量/每日']*FY ['价格/件']).sum()
print("T血销售额占比:",format(TX1/zj,'.2%'))
print("牛仔裤销售额占比:",format(NZK1/zj,'.2%'))
print("皮草销售额占比:",format(PC1/zj,'.2%'))
print("羽绒服销售额占比:",format(YRF1/zj,'.2%'))
print("衬衫销售额占比:",format(CS1/zj,'.2%'))
print("风衣销售额占比:",format(FY1/zj,'.2%'))